#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
typedef long long ll;
int main()
{
	ll t;
	cin >> t;
	while (t--)
	{
		ll n;
		cin >> n;
		cout << n * (n + 2) + 2 << endl;
	}
	return 0;
}